@extends('layout.admin.master')
@section('content')

    <div class="card">
        <div class="card-header container-fluid">

            <h4 class="card-header-title">
                添加栏目
            </h4>
        </div>
        <div class="container-fluid">
            <ul class="nav nav-tabs mb-4">
                <li class="nav-item">
                    <a class="nav-link " href="{{route('admin.column.index')}}">栏目列表</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" href="{{route('admin.column.create')}}">添加栏目</a>
                </li>
            </ul>
        </div>
        <div class="container-fluid">

            <div class="card">
                <div class="card-body">
                    <form action="{{route('admin.column.store')}}" method="post">
                        @csrf
                        <div class="form-group">
                            <label for="">栏目名称</label>
                            <input type="text" name="name" id="" class="form-control" placeholder=""
                                   aria-describedby="helpId">
                        </div>
                        <div class="form-group">
                            <label for="">图标</label>
                            <div class="input-group mb-3">
                                <div class="input-group-prepend">
                            <span class="input-group-text">
                                <i id="icon" class=""></i>
                            </span>
                                </div>
                                <input readonly type="text" name="icon" class="form-control" >
                                <div class="input-group-append">
                                    <a href="javascript:;" onclick="ChoseIcon()" class="input-group-text">选择图标</a>
                                </div>
                            </div>
                        </div>
                        <div>
                            <button class="btn btn-primary">添加</button>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>


@endsection

@push('js')

    <script>
        function ChoseIcon() {
            require(['hdjs'], function (hdjs) {
                hdjs.font(function(icon){
                    $('input[name=icon]').val(icon);
                    $('#icon').attr('class',icon);
                })
            })

        }
    </script>


@endpush

